﻿using System.Collections.Generic;
using Core.Log;

namespace Core.Event {
    /// <summary>
    /// 事件类
    /// </summary>
    public class GameEvent {
        private object[] param;
        
        public GameEventID EventID {
            get;
            private set;
        }

        public void SetEvent(GameEventID id, params object[] param) {
            EventID = id;
            this.param = param;
        }

        public T GetParameter<T>(int index) {
            if (index < 0 || index >= param.Length) {
                ADbg.LogEF("[Event]尝试从ID ：{0} 的事件中获取索引为 {1} 的参数",(int)EventID, index);
                return default;
            }
            
            return (T)param[index];
        }
        
    }
}